package com.ruoyi.restaurant.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.restaurant.mapper.ResCategoryMapper;
import com.ruoyi.restaurant.domain.ResCategory;
import com.ruoyi.restaurant.service.IResCategoryService;

/**
 * 菜品分类Service业务层处理
 * 
 * @author adnaan
 * @date 2023-12-08
 */
@Service
public class ResCategoryServiceImpl implements IResCategoryService 
{
    @Autowired
    private ResCategoryMapper resCategoryMapper;

    /**
     * 查询菜品分类
     * 
     * @param id 菜品分类主键
     * @return 菜品分类
     */
    @Override
    public ResCategory selectResCategoryById(Long id)
    {
        return resCategoryMapper.selectResCategoryById(id);
    }

    /**
     * 查询菜品分类列表
     * 
     * @param resCategory 菜品分类
     * @return 菜品分类
     */
    @Override
    public List<ResCategory> selectResCategoryList(ResCategory resCategory)
    {
        return resCategoryMapper.selectResCategoryList(resCategory);
    }

    /**
     * 新增菜品分类
     * 
     * @param resCategory 菜品分类
     * @return 结果
     */
    @Override
    public int insertResCategory(ResCategory resCategory)
    {
        resCategory.setCreateTime(DateUtils.getNowDate());
        return resCategoryMapper.insertResCategory(resCategory);
    }

    /**
     * 修改菜品分类
     * 
     * @param resCategory 菜品分类
     * @return 结果
     */
    @Override
    public int updateResCategory(ResCategory resCategory)
    {
        resCategory.setUpdateTime(DateUtils.getNowDate());
        return resCategoryMapper.updateResCategory(resCategory);
    }

    /**
     * 批量删除菜品分类
     * 
     * @param ids 需要删除的菜品分类主键
     * @return 结果
     */
    @Override
    public int deleteResCategoryByIds(Long[] ids)
    {
        return resCategoryMapper.deleteResCategoryByIds(ids);
    }

    /**
     * 删除菜品分类信息
     * 
     * @param id 菜品分类主键
     * @return 结果
     */
    @Override
    public int deleteResCategoryById(Long id)
    {
        return resCategoryMapper.deleteResCategoryById(id);
    }
}
